#ifndef XSERIALPORTLIST_H
#define XSERIALPORTLIST_H

#include <QObject>
#include <QTimer>
#include <QSerialPort>
#include <QStringList>
#include <QSerialPortInfo>

class XSerialPortList : public QObject
{
    Q_OBJECT
public:
    XSerialPortList(QObject *parent = nullptr);
    XSerialPortList(quint16);
    virtual ~XSerialPortList();
    void ScanStart();   //扫描开始
    void ScanStop();    //扫描停止

public slots:
    void slot_onTimeOut();  //定时函数

private:
    quint16 scanCycleMs;    //扫描周期
    QTimer* timer;          //定时器
    QStringList oldPortStringList;  //列表

signals:
    void signal_onNewSerialPort(QStringList);   //信号
};

#endif // XSERIALPORTLIST_H
